<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>重理学生管理系统 - 登录/注册</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }

        .login-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
        }

        .system-title {
            text-align: center;
            color: #333;
        }

        .system-subtitle {
            text-align: center;
            color: #666;
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 3px;
        }

        .error-message {
            color: red;
            display: none;
        }

        .login-btn {
            width: 100%;
            padding: 10px;
            background-color: #3498db;
            color: #fff;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }

        .login-btn:hover {
            background-color: #2980b9;
        }

        .register-link {
            display: block;
            margin-top: 10px;
            text-align: center;
            color: #3498db;
            cursor: pointer;
        }

        #registerForm {
            display: none;
        }

        .school-info {
            text-align: center;
            color: #999;
            margin-top: 20px;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>

<body>
<div class="login-container">
    <h1 class="system-title">重理学生管理系统</h1>
    <p class="system-subtitle">Chongqing University of Technology</p>

    <form id="loginForm" action="login" method="POST">
        <div class="form-group">
            <input type="text" name="account" placeholder="请输入账号" required>
            <div class="error-message" id="account-error">请输入有效的账号</div>
        </div>
        <div class="form-group">
            <input type="password" name="password" placeholder="请输入密码" required>
            <div class="error-message" id="password-error">请输入有效的密码</div>
        </div>
        <button type="submit" class="login-btn">登 录</button>
    </form>

    <span class="register-link" onclick="showRegisterForm()">注册新用户</span>

    <form id="registerForm" action="register" method="POST">
        <div class="form-group">
            <input type="text" name="username" placeholder="请输入用户名" required>
            <div class="error-message" id="register-username-error">请输入有效的用户名</div>
        </div>
        <div class="form-group">
            <input type="text" name="account" placeholder="请输入账号" required>
            <div class="error-message" id="register-account-error">请输入有效的账号</div>
        </div>
        <div class="form-group">
            <input type="password" name="password" placeholder="请输入密码" required>
            <div class="error-message" id="register-password-error">请输入有效的密码</div>
        </div>
        <button type="submit" class="login-btn">注 册</button>
    </form>

    <div class="school-info">
        © 2025 重庆理工大学
    </div>
</div>

<script>
    function showRegisterForm() {
        document.getElementById('loginForm').style.display = 'none';
        document.getElementById('registerForm').style.display = 'block';
    }
</script>
</body>

</html>